package Day06;

import java.sql.SQLOutput;

public class Dog extends Animal {
    public String name = "狗";//狗的名字
    public int age = 10;  //狗的年龄

    public Dog() {
    }

    public Dog(String name, int age) {
        this.name = name;
        this.age = age;
    }

    //重写了eat()方法
    public void eat(){
        System.out.println("狗吃");

    }
}

//定义一个猫类
class Cat extends Animal{
    public String name = "猫";  //猫的名字
    public int age = 100;  //猫的年龄

    public Cat() {
    }

    public Cat(String name, int age) {
        this.name = name;
        this.age = age;
    }

    //猫的行为(吃)
    public void eat(){
        System.out.println("猫吃");
    }
}

//定义一个鸡类
class chicken extends Animal{
    public String name; // 鸡的名字

    public int age;  //鸡的年龄

    //鸡的行为(吃)
    public void eat(){
        System.out.println("鸡吃");
    }
}

class Text{
    public static void main(String[] args) {
        //定义一个Dog对象
        Dog dog = new Dog();
        dog.eat();     //调用eat()方法
    }
}


